using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

using Peradigm.Framework.Domain.Security;
using Peradigm.Framework.Persistence;

using Liberty.Domain.Kernel;
using Liberty.Domain.GrantManagement;
using Liberty.Domain.ServiceMemberManagement;

namespace Liberty.Domain.CaseManagement
{
    [Serializable]
    public class Injury : PersistentModel
    {
        #region Constants
        #endregion

        #region Event Handlers
        #endregion

        #region Methods
        /// <summary>
        /// Creates a stubbed injury populated with frequently used primitives.  
        /// Other aggregated objects are not populated by this factory method.
        /// </summary>
        /// <returns></returns>
        public static Injury TestInstance()
        {
            Injury stub = new Injury();
            stub.CreatedDate = DateTime.Now.AddMonths( -1 );            
            stub.Oid = 12L;
            stub.UpdatedDate = DateTime.Now.AddDays( -5 );
            stub.TypeOfInjury = TypeOfInjury.TestInstance();

            return stub;
        }
        #endregion

        #region Properties
        public DateTime? CreatedDate
        {
            get
            {
                if( i_CreatedDate.HasValue )
                {
                    return i_CreatedDate.Value;
                }
                else
                {
                    return null;
                }
            }
            set
            {
                if( value.HasValue )
                {
                    i_CreatedDate = value;
                }
                else
                {
                    i_CreatedDate = null;
                }
            }
        }

        public DateTime? UpdatedDate
        {
            get
            {
                if( i_UpdatedDate.HasValue )
                {
                    return i_UpdatedDate.Value;
                }
                else
                {
                    return null;
                }
            }
            set
            {
                if( value.HasValue )
                {
                    i_UpdatedDate = value;
                }
                else
                {
                    i_UpdatedDate = null;
                }
            }
        }

        public TypeOfInjury TypeOfInjury
        {
            get { return i_TypeOfInjury; }
            set { i_TypeOfInjury = value; }
        }
        #endregion

        #region Private Methods
        
        #endregion

        #region Private Properties
        #endregion

        #region Construction and Finalization
        public Injury()
        {
        }

        [Obsolete( "Upgrade to the complete constructor." )]
        public Injury( TypeOfInjury typeOfInjury )
        {
            this.TypeOfInjury = typeOfInjury;
        }

        public Injury( long oid, byte[] rowlock, TypeOfInjury typeOfInjury )
            : base( oid, rowlock )
        {            
            this.TypeOfInjury = typeOfInjury;
        }
        #endregion

        #region Data Elements
        private TypeOfInjury i_TypeOfInjury;
#warning Are these still necessary?
        private DateTime? i_CreatedDate;
        private DateTime? i_UpdatedDate;
        #endregion

    }
}



